package com.android.qjpmc.manager;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

import androidx.fragment.app.FragmentActivity;

import com.android.qjpmc.R;
import com.android.qjpmc.application_module.activity.ScanActivity;
import com.android.qjpmc.application_module.activity.SelectAlarmDataActivity;
import com.android.qjpmc.application_module.activity.SelectReportDataActivity;
import com.android.qjpmc.application_module.activity.SensorDataActivity;
import com.android.qjpmc.application_module.activity.VideoActivity;
import com.android.qjpmc.application_module.home.activity.AlarmRecordDetailActivity;
import com.android.qjpmc.application_module.home.activity.ErrorDetailsActivity;
import com.android.qjpmc.application_module.home.activity.HomeActivity;
import com.android.qjpmc.application_module.activity.ApprovalTicketActivity;
import com.android.qjpmc.application_module.activity.HistoryCurveActivity;
import com.android.qjpmc.application_module.activity.SelectStationActivity;
import com.android.qjpmc.application_module.activity.CoalMineTwoActivity;
import com.android.qjpmc.application_module.activity.DeveloperDebuggingActivity;
import com.android.qjpmc.application_module.activity.LoginActivity;
import com.android.qjpmc.application_module.activity.ModifyTicketInformationActivity;
import com.android.qjpmc.application_module.activity.SelectDataActivity;
import com.android.qjpmc.application_module.activity.FaultWaveDetailActivity;
import com.android.qjpmc.application_module.activity.RealtimeDataActivity;
import com.android.qjpmc.application_module.activity.RealtimeCurveActivity;
import com.android.qjpmc.application_module.activity.UserReloginActivity;
import com.android.qjpmc.application_module.activity.StationActivity;
import com.android.qjpmc.application_module.activity.VideoMonitorActivity;
import com.android.qjpmc.application_module.activity.HistoryDataActivity;
import com.android.qjpmc.application_module.activity.FaultWaveActivity;
import com.android.qjpmc.bean.StationVideoListBean;
import com.android.qjpmc.widget.BigImagePagerActivity;
import com.android.qjpmc.widget.bean.WebViewInfo;
import com.android.qjpmc.widget.retrofithelper.http.Url;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class IntentManager {
    public static void toBigImageActivity(FragmentActivity activity, List<String> list, int position, int type) {
        Intent intent = new Intent(activity, BigImagePagerActivity.class);
        intent.putExtra(BigImagePagerActivity.INTENT_IMG_URLS, (Serializable) list);
        intent.putExtra(BigImagePagerActivity.INTENT_POSITION, position);
        intent.putExtra(BigImagePagerActivity.INTENT_IAG_TYPE, type);
        activity.startActivity(intent);

        activity.overridePendingTransition(R.anim.fade_in,
                R.anim.fade_out);

    }

    public static void toBigImageNetActivity(FragmentActivity activity, String path, int position) {
        ArrayList<String> strings = new ArrayList<>();
        strings.add(path);
        toBigImageActivity(activity, strings, position, BigImagePagerActivity.TYPE_NET_IMAGE);
    }

    public static void toBigImageNetActivity(FragmentActivity activity, List<String> path, int position) {

        toBigImageActivity(activity, path, position, BigImagePagerActivity.TYPE_NET_IMAGE);
    }

    public static void toBigImageFileActivity(FragmentActivity activity, String path, int position) {
        ArrayList<String> strings = new ArrayList<>();
        strings.add(path);
        toBigImageActivity(activity, strings, position, BigImagePagerActivity.TYPE_FILE_IMAGE);
    }

    public static void toBigImageFileActivity(FragmentActivity activity, List<String> path, int position) {

        toBigImageActivity(activity, path, position, BigImagePagerActivity.TYPE_FILE_IMAGE);
    }


    public static void toBaseWebViewActivity(Context activity, String title, String url) {
        WebViewInfo info = new WebViewInfo();
        info.url = url;
        info.title = title;
        toBaseWebViewActivity(activity, info);
    }

    public static void toPDFWebViewActivity(Context activity, String title, String url) {
        WebViewInfo info = new WebViewInfo();
        info.url = Url.BASE_PDF_URL + url;
        info.title = title;
        toBaseWebViewActivity(activity, info);
    }

    public static void toBaseWebViewActivity(Context activity, String url) {
        toBaseWebViewActivity(activity, "", url);
    }

    public static void toBaseWebViewActivity(Context activity, String url, int fromType, String id) {
        WebViewInfo info = new WebViewInfo();
        info.url = url;
        info.title = "";
        info.fromType = fromType;
        info.id = id;
        toBaseWebViewActivity(activity, info);
    }

    public static void toBaseWebViewActivity(Context activity, WebViewInfo info) {

    }


    public static void toStsyemWeb(FragmentActivity activity, String url) {

       /* Uri uri = Uri.parse(url);
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        activity.startActivity(intent);*/
        //从其他浏览器打开
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_VIEW);
        Uri content_url = Uri.parse(url);
        intent.setData(content_url);
        if (intent.resolveActivity(activity.getPackageManager()) != null) {
            activity.startActivity(Intent.createChooser(intent, "请选择浏览器"));
        }
    }

    public static void toHomeActivity(Activity activity) {
        Intent intent = new Intent(activity, HomeActivity.class);
        activity.startActivity(intent);
    }

    public static void toCourseDetailsActivity(Context activity, String id) {

    }

    public static void toReportDataActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, SelectReportDataActivity.class);
        activity.startActivity(intent);
    }

    public static void toApprovalTicketActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, ApprovalTicketActivity.class);
        activity.startActivity(intent);
    }

    public static void toDeveloperDebuggingActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, DeveloperDebuggingActivity.class);
        activity.startActivity(intent);
    }

    public static void toScanActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, ScanActivity.class);
        activity.startActivityForResult(intent, 10000);
    }

    public static void toModifyTicketInformationActivity(FragmentActivity activity, int type) {
        Intent intent = new Intent(activity, ModifyTicketInformationActivity.class);
        intent.putExtra("type", type);
        activity.startActivity(intent);
    }

    public static void toUserInformationActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, UserReloginActivity.class);
        activity.startActivity(intent);
    }

    public static void toLoginActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, LoginActivity.class);
        activity.startActivity(intent);
    }

    public static void toSelectDataActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, SelectDataActivity.class);
        activity.startActivity(intent);
    }

    public static void toApprovalTicketTwoActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, HistoryCurveActivity.class);
        activity.startActivity(intent);
    }

    public static void toTransformerSubstationActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, FaultWaveDetailActivity.class);
        activity.startActivity(intent);
    }

    public static void toTransformerSubstationTwoActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, FaultWaveActivity.class);
        activity.startActivity(intent);
    }

    public static void toTransformerSubstationHistoryDataActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, HistoryDataActivity.class);
        activity.startActivity(intent);
    }

    public static void toHistoryDataActivity(FragmentActivity activity, String stationId, String companyName) {
        Intent intent = new Intent(activity, HistoryDataActivity.class);
        intent.putExtra("stationId", stationId);
        intent.putExtra("stationName", companyName);
        activity.startActivity(intent);
    }

    public static void toTransformerSubstationFourActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, RealtimeCurveActivity.class);
        activity.startActivity(intent);
    }

    public static void toTransformerSubstationFiveActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, RealtimeDataActivity.class);
        activity.startActivity(intent);
    }

    public static void toTransformerSubstationSixActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, VideoMonitorActivity.class);
        activity.startActivity(intent);
    }

    public static void toStationActivity(FragmentActivity activity, String stationId) {
        Intent intent = new Intent(activity, StationActivity.class);
        intent.putExtra("stationId", stationId);
        activity.startActivity(intent);
    }

    public static void toCoalMineActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, SelectStationActivity.class);
        activity.startActivity(intent);
    }

    public static void toCoalMineTwoActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, CoalMineTwoActivity.class);
        activity.startActivity(intent);
    }

    public static void toErrorDetailsActivity(Context activity) {
        Intent intent = new Intent(activity, ErrorDetailsActivity.class);
        activity.startActivity(intent);

    }

    public static void toAlarmRecordDetailActivity(Context context) {
        Intent intent = new Intent(context, AlarmRecordDetailActivity.class);
        context.startActivity(intent);

    }

    public static void toSelectAlarmDataActivity(FragmentActivity activity) {
        Intent intent = new Intent(activity, SelectAlarmDataActivity.class);
        activity.startActivity(intent);
    }

    public static void toVideoActivity(FragmentActivity activity, StationVideoListBean videoInfo) {

        Intent intent = new Intent(activity, VideoActivity.class);
        intent.putExtra("videoInfo", videoInfo);
        activity.startActivity(intent);
    }

    public static void toSensorDataActivity(FragmentActivity activity, String deviceCode, String companyCode, String groupId) {
        Intent intent = new Intent(activity, SensorDataActivity.class);
        intent.putExtra("deviceCode", deviceCode);
        intent.putExtra("companyCode", companyCode);
        intent.putExtra("groupId", groupId);
        activity.startActivity(intent);
    }
}
